package reflection.demo;

/**
 * @author gao
 * @date 2025/10/16 20:28
 */

class Student {
    private String name = "yang";
    public int age = 18;

    public Student() {
        System.out.println("Student()");
    }

    private Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("Student(name, age)");
    }

    private void eat() {
        System.out.println("I'm eating");
    }

    public void sleep() {
        System.out.println("I'm sleeping");
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

public class Test {
    public static void main(String[] args) {
        Class<?> c1 = null;
        try {
            c1 = Class.forName("reflection.demo.Student");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }

        Class<?> c2 = Student.class;

        Student student = new Student();
        Class<?> c3 = student.getClass();
    }
}